package com.huilian.iotbox.admin.wap.controller;

import com.huilian.iotbox.admin.wap.service.StmtResultService;
import com.huilian.iotbox.admin.wap.service.UserService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.controller.BaseController;
import com.huilian.iotbox.data.dto.StmtResultDto;
import com.huilian.iotbox.data.vo.UserInfo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author zengxilin
 * @CreateDate: 2021-10-04 12:22
 * @Description:
 */
@RestController
@RequestMapping("/api/stmtResult")
public class StmtResultController extends BaseController {
    @Resource
    private StmtResultService stmtResultService;
    @Resource
    private UserService userService;

    @PostMapping("/findStmtResult")
    public ServerResponse findStmtResult(@RequestBody StmtResultDto stmtResultDto, HttpServletRequest request) {
        UserInfo userInfo = userService.getLoginUserInfo(request);
        stmtResultDto.setUserInfo(userInfo);
        stmtResultDto.setUserId(userInfo.getId());
        return stmtResultService.findStmtResultList(stmtResultDto);
    }
}
